using UnityEngine;
using System.Collections;

public class CameraZoomOutState : State<CameraControl> 
{
	#region Singleton

    private static CameraZoomOutState instance = new CameraZoomOutState();
    public static CameraZoomOutState Instance { get { return instance; } }
    private CameraZoomOutState() { }

    #endregion

    #region State

    public override void OnEnter(CameraControl behaviour)
    {
		//Debug.Log ("Zoom out");
		behaviour.zoomOut = true;
        
    }

    public override void OnUpdate(CameraControl behaviour)
    {
		if (!Input.GetKey("space"))
		{
			behaviour.RevertToPreviousState();
		}
		
		behaviour.currentTargetDistance = behaviour.transform.position + behaviour.distance;
		behaviour.moveDistance = behaviour.CalculateMoveDistance(behaviour.overviewPos);
		behaviour.Move(behaviour.moveDistance, behaviour.currentTargetDistance);

        // Final Tasks
        behaviour.targetDistance = behaviour.currentTargetDistance;
        behaviour.mainCamera.transform.eulerAngles = behaviour.camRotation;

        
    }

    public override void OnExit(CameraControl behaviour)
    {
        behaviour.zoomOut = false;
    }

    public override void OnAction(string name, CameraControl behaviour, object value)
    {
    }

    #endregion
}